home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
newsgroups
/
misc.20000824-20010305
/
000156_news@columbia.edu _Fri Dec 29 07:42:35 2000.msg
< prev
next >
Wrap
Internet Message Format
|
2020-01-01
|
4KB
Return-Path: <news@columbia.edu>
Received: from watsun.cc.columbia.edu (watsun.cc.columbia.edu [128.59.39.2])
by monire.cc.columbia.edu (8.9.3/8.9.3) with ESMTP id HAA20734
for <kermit.misc@cpunix.cc.columbia.edu>; Fri, 29 Dec 2000 07:42:35 -0500 (EST)
Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.59.30])
by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id HAA16674
for <kermit.misc@watsun.cc.columbia.edu>; Fri, 29 Dec 2000 07:42:35 -0500 (EST)
Received: (from news@localhost)
by newsmaster.cc.columbia.edu (8.9.3/8.9.3) id HAA24572
for kermit.misc@watsun.cc.columbia.edu; Fri, 29 Dec 2000 07:30:41 -0500 (EST)
X-Authentication-Warning: newsmaster.cc.columbia.edu: news set sender to <news> using -f
From: Igor Sobrado <sobrado@string1.ciencias.uniovi.es>
Subject: Re: A wish for the FTP-client
Date: 29 Dec 2000 12:29:19 GMT
Organization: Universidad de Oviedo
Message-ID: <92i02v$m4u$1@news01.si.uniovi.es>
To: kermit.misc@columbia.edu
Frank da Cruz <fdc@watsun.cc.columbia.edu> wrote:
> In article <3A4BA47C.53C64EBA@srv.net>, Kevin Handy <kth@srv.net> wrote:
> : Frank da Cruz wrote:
> : > ... How do you convert a
> : > struct tm to a time_t in a reliable way? -- i.e. without writing code to
> : > count days, months, years, leap years, leap seconds, and all the rest,
> : > taking each machine's architecture into account. I'm sure I must have
> : > overlooked something obvious -- feel free to embarrass me.
I agree with you, C-Kermit is really portable to a lot of different
machine architectures and this important feature should not be ignored
when developers improve its functionality.
> : Under *nix, I believe the function to use is mktime
> :
> : time_t mktime(struct tm *timeptr)
It is right, I think it is the only way to get it in a portable way.
> 1. The first place I looked (SunOS) doesn't have it. However, must other
> UNIX OS's do have it. But...
It should. At least in recent releases of SunOS, a description of this
function can be found in mktime(3C), that is, in the C Library
Functions section of the manual. Probably you are looking in a
workstation where Solaris is not fully installed (perhaps a final
user installation, not a developer one).
> 2. Doesn't do what you want. "In addition to computing the calendar time,
> mktime() normalizes the supplied tm structure" -- applies timezone
> conversions, etc. The problem there is, of course, we don't know, and
> have no way to find out, the server's timezone, and even if we knew it,
> what the rules are to convert to our own. The struct tm is *already* in
> GMT/UTC, and should not be converted to it again.
>
> Thus the resulting file date won't be what you want. I think the object
> of copying the server's MDTM is so update can work in both directions. If
> we use mktime(), I think the result will have up to 24 hours of randomness
> added or subtracted. Am I missing something?
As you noted, the FTP-server provides the time in UTC/GMT, all
Unix boxes work with that standard convention. The second (incorrect)
conversion to UTC is made locally by the host where C-Kermit
is installed because mktime(3C) supposes that the tm structure is
in local format, not it UTC. Why not calculate the UTC offset for
the time (as if it is in local format) and "correct" the time
either before converting it to a time_t structure or after that?
Best regards,
Igor.
--
Igor Sobrado, UK34436 - sobrado@acm.org